﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10一元运算符
{
    class Program
    {
        static void Main(string[] args)
        {
            //一元运算符
            ////int agn = 18;
            ////int sum = agn++ - 10;
            ////Console.WriteLine("sum={0}",sum);
            //////上面代码agn是后加，所以语句运行时，agn++取agn原值参与运行，所以sum=8
            ////int yun = 18;
            ////int dao = ++yun - 10;
            ////Console.WriteLine("dao={0}",dao);
            //////上面代码agn是前加加，所以在进行运算时，++agn取agn加1后的新值参与运算，所以sum=9
            ////int gum = 18;
            ////int sre = gum-- - 10;
            ////Console.WriteLine("sre={0}", sre);
            ////int ret = 18;
            ////int cer = --ret - 10;
            ////Console.WriteLine("cer={0}", cer);



            //bool类型|关系运算符
            //int dax = 1500;
            //int las = 1;
            //bool it = dax > las;
            //Console.WriteLine(it);


            //逻辑运算符 
            //逻辑与&&
            //int sge = 10;
            //int ti = 12;
            //bool ip = sge <= 100 && ti <= 100;
            //Console.WriteLine(ip);
            //逻辑或||
            //Console.WriteLine("请输入你的身高(cm):");
            //int sgn = Convert.ToInt32(Console.ReadLine());
            //Console.WriteLine("请输入你的体重(kg):");
            //int sne = Convert.ToInt32(Console.ReadLine());
            //bool hum = sgn > 120 || sne > 40;
            //Console.WriteLine(hum);


            //Console.WriteLine("你的语文成绩是：");
            //int gnm = Convert.ToInt32(Console.ReadLine());
            //Console.WriteLine("你的数学" + "成绩是：");
            //int ken = Convert.ToInt32(Console.ReadLine());
            //bool intl = gnm > 90 && ken > 90;
            //bool intk = gnm > 90 || ken > 90;
            //Console.WriteLine("你的语文数学成绩都大于90为:{0}",intl);
            //Console.WriteLine("你的语文数学成绩有一门大于90为:{0}",intk);


            //Console.WriteLine("请输入一个年份：");
            //int kn = Convert.ToInt32(Console.ReadLine());
            //bool io = (kn % 400 == 0) || ((kn % 4 == 0) && (kn % 100 != 0));
            //Console.WriteLine(io);

            //与和或的短路
            int a = 10;
            int b = 5;
            //bool it = ++a > 50 && ++b > 1;
            bool it = ++a > 50 || ++b > 1;
            Console.WriteLine("a={0}    b={1}", a, b);




            Console.ReadKey();
        }
    }
}
